package com.zzxy.springmvc12.controller;

import com.zzxy.springmvc12.po.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.swing.*;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

@Controller
@RequestMapping("/stu")
public class StudentController {
    @RequestWrapping("/register")
    public String register(){
        return "/user/register";
    }

    @RequestWrapping("insert")
    public @ResponseBody Student insert(@ResponseBody Student student){
        student.setPassword(student.getPassword()+":qwe");
        student.setUsername(student.getUsername()+":asd");
        return student;
    }
@RequestMapping("/addStu")
public String addStu(String username,String password){
        System.out.println(username);
        System.out.println(password);
        //service > dao > insert into student ...
    return "/user/userList";
}

    @RequestMapping("/addStu1")
    public String addStu1(Student student){
        System.out.println(student);
        return "/user/userList";
    }
    @RequestWrapping("insert")
    public Student insert(@RequestBody Student student){
        return student;
    }
    @RequestMapping("/addStu2")
    public String addStu2(StudentExt ext){

    }





    public String addStu(String username, Spring password){
        System.out.println(username);
        System.out.println(password);
        return "/user/userList";
    }

    private class StudentExt {
    }
}
